home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-1097 / AMOSLIST / text0052.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  1.5 KB  |  61 lines

  1. On 03-Okt-97, Peter Falkesand smashed the keyboard with:
  2. >Hi!
  3.  
  4. >Is there a smooth way to sort 20 variables???
  5. >and not do like this..
  6.  
  7. >--------------------------------
  8.  
  9. >If score1_1(1)>score2_1(1)
  10.  
  11. >Loke S7+40,Leek(S5+20)
  12.  
  13. >endif
  14.  
  15. >if score1_2(2)>score2_1(1)
  16.  
  17. >loke s7+60,leek(s5+40)
  18.  
  19. >endif
  20.  
  21. >-------------------------------
  22. *sigh*, that's BIG
  23.  
  24. >This way makes the program very big..!
  25. >Any soloution anyone????
  26.  
  27. This is from memory, so might not be perfect:
  28.  
  29. L=$7FFFFFFF 
  30. For A=1 to 20
  31.    T=-1 : SN=-1
  32.    For B=2 to 20
  33.       If SCORE(B)>T and SCORE(B)<L
  34.          T=SCORE(B) : SN=B 
  35.       Endif
  36.    Next B
  37.    If SN>-1
  38.       'SN will hold the index-number of the score
  39.       'Put is down where you'd like it to be
  40.       'A holds the rating of the score (1=High, 20=Low)
  41.    Else
  42.       Exit
  43.    Endif
  44.    L=T 
  45. Next A
  46.  
  47. NOTE: This won't handle two equal scores (I'll lose one of 'em), but that
  48. should not be so hard to handle (Let me know if you got problems with it)
  49.  
  50. -- 
  51. Happy greetings, Yours..
  52. __________________________________________________________________________
  53.  /_  __/ __  / __  /\  ___\  __ \__  _\           aka. JENS VANG PETERSEN
  54.   / / / /_/ / ____/  \ \___\  __ \ \ \  Nyvej 8, DK-4450 Jyderup, Denmark
  55.  /_/ /_____/_/        \_____\_\ \_\ \_\             top_cat@post8.tele.dk
  56. --------------------------------------------------------------------------
  57.  Never forget the 'Queen Of Hearts', Diana, Princess Of Wales, 1961->1997
  58. --------------------------------------------------------------------------
  59.  
  60.  
  61.